package com.quanquan.parking.ketop.service;

import com.quanquan.parking.ketop.api.BaseApi;
import com.quanquan.parking.ketop.entity.params.request.CardRechargeRequest;
import com.quanquan.parking.ketop.entity.params.request.PayParkingFeeRequest;
import com.quanquan.parking.ketop.entity.params.request.QueryParkingFeeRequest;
import org.springframework.stereotype.Service;

import java.text.DecimalFormat;

/**
 * @ClassName:ParkingService
 * @Description:TODO
 * @Author:xiongjunbao
 * @Date:2019/4/3 13:23
 * @Version 1.0
 */
@Service
public class Test {

    public static void main(String[] args) {
        //如果待支付金额为0，直接更新订单为已支付
        PayParkingFeeRequest parkingRecordRequest1 = new PayParkingFeeRequest();


       /* parkingRecordRequest1.setOrderNo("0001201909271254030873");
        parkingRecordRequest1.setAmount(0);
        parkingRecordRequest1.setDiscount(0);
        parkingRecordRequest1.setFreeTime(0);
        parkingRecordRequest1.setFreeMoney(150);
        parkingRecordRequest1.setPayType(30);
        parkingRecordRequest1.setPayMethod(17);
        List<FreeDetail> freeDetails = new LinkedList<>();
        FreeDetail freeDetail = new FreeDetail();
        freeDetail.setType(0);
        freeDetail.setMoney(150);
        freeDetail.setTime(0);
        freeDetail.setCode("00000000000000000002");
        freeDetails.add(freeDetail);
        parkingRecordRequest1.setFreeDetail(freeDetails);
        String apiName = "pay/PayParkingFee";*/

        /*parkingRecordRequest1.setOrderNo("0001201909271433438507");
        parkingRecordRequest1.setFreeTime(0);
        parkingRecordRequest1.setFreeMoney(150);
        List<FreeDetail> freeDetails = new LinkedList<>();
        FreeDetail freeDetail = new FreeDetail();
        freeDetail.setType(0);
        freeDetail.setMoney(150);
        freeDetail.setTime(0);
        freeDetail.setCode("900101190904000013");
        freeDetails.add(freeDetail);
        parkingRecordRequest1.setFreeDetail(freeDetails);
        String apiName = "pay/GetPaymentRecharge";*/

       /* String apiName = "pay/GetParkingPaymentInfo";
        parkingRecordRequest1.setPlateNo("苏AJFXCX");

        try {
            BaseApi.doApi(parkingRecordRequest1, apiName);
        }catch (Exception e){
            System.out.println("不好好走路");
        }*/

        /*Integer a = 100;
        Double b = 0.5;
        BigDecimal b1 = new BigDecimal(Double.toString(a));
        BigDecimal b2 = new BigDecimal(Double.toString(b));
        NumberFormat nf = NumberFormat.getInstance();
        //设置保留多少位小数
        nf.setMaximumFractionDigits(4);
        // 取消科学计数法
        nf.setGroupingUsed(false);
        nf.format(b1.add(b2).doubleValue());
        System.out.println(nf.format(b2.divide(b1).doubleValue()));*/

       /* QueryParkingFeeRequest request = new QueryParkingFeeRequest();
        request.setPlateNo("苏A1");
        request.setPageIndex(1);
        request.setPageSize(50);

        String apiName = "pay/GetFuzzyCarInfo";
        try {
            BaseApi.doApi(request, apiName);
        }catch (Exception e){
            System.out.println("不好好走路");
        }*/

       Integer a = 0;
        DecimalFormat df = new DecimalFormat("0.00");
        double fee = a.doubleValue();
        String feeYuan = df.format(fee / 100);
        System.out.println(feeYuan);

        /*TestRequest request = new TestRequest();
        request.setPlateNo("苏AJFXCX");
        String apiName = "pay/GetCarCardInfo";
        try {
            BaseApi.doApi(request, apiName);
        }catch (Exception e){
            System.out.println("不好好走路");
        }*/
        /*CardRechargeRequest request = new CardRechargeRequest();
        request.setCardId(716);
        request.setPayMoney("100");
        request.setRuleAmount("1");
        request.setRuleType("1");
        request.setStartTime("2019-11-01 00:00:00");
        request.setEndTime("2019-11-30 23:59:59");
        String apiName = "pay/CardRecharge";
        try {
            System.out.println(BaseApi.doApi(request, apiName));
        }catch (Exception e){
            System.out.println("不好好走路");
        }*/

       /* TestRequest request = new TestRequest();
        request.setCarType("5");
        String apiName = "pay/GetCardRule";
        try {
            BaseApi.doApi(request, apiName);
        }catch (Exception e){
            System.out.println("不好好走路");
        }*/



    }


}
